<template>
  <view>
    <Header type="back" title="意见反馈" />

    <view class="w-100" :class="'h' + bar_h"></view>
    <view
      class="bg-f8ff w-100 ab left0 bottom0 rounded-120-bottom ov-hd-y"
      :class="'top' + bar_h"
    >
      <view class="w-100 px-3">
        <view class="w-100 bg-theme">
          <view class="w-100 h-100 bg-f8ff radius-54-right px-2 py-3">
            <view class="w-100 f-s-c mb-2">
              <textarea
                class="uni-input border h280 font28 p-2 w-100"
                style="min-height: 200px"
                placeholder="请输入意见内容"
                v-model="feedback.content"
                auto-height
              />
              <!-- <input class="uni-input border h80 font28 px-2 w476" v-model="feedback.content" placeholder="请输入意见" /> -->
            </view>
            <view class="w-100 h80 f-s-c mb-2">
              <view class="w200 font28">联系电话：</view>
              <input
                class="uni-input border h80 font28 px-2 w476"
                v-model="feedback.mobile"
                placeholder="请输入电话"
              />
            </view>

            <view class="w-100 h100 f-c-c pt-10">
              <view
                class="w270 h90 bg-theme font32 t-20 font600 f-c-c circle14"
                @click="get_feedback_info()"
                >提 交</view
              >
            </view>
          </view>
        </view>
      </view>
    </view>
    <SimpleDateTimePicker
      ref="myPicker_info"
      @submit="handleSubmit"
      :start-year="2012"
      :end-year="2030"
    />
  </view>
</template>

<script>
import { feedback } from "../../../api/user.js";
import Header from "../../../components/header.vue";
export default {
  components: {
    Header,
  },
  data() {
    return {
      bar_h: 0,
      feedback: {
        content: "",
        images: "www",
        mobile: "",
        orgId: "",
      },
    };
  },

  created() {
    const { statusBarHeight } = uni.getStorageSync("systemInfo");
    this.bar_h = 100 + statusBarHeight / (uni.upx2px(100) / 100); // 状态栏高度  +  预留背景高度 整个背景高度

    let user_info = uni.getStorageSync("userInfo") || {};
    this.feedback.orgId = user_info.orgId || "L43Q4SG4";
    this.feedback.mobile = user_info.phone;
  },
  methods: {
    //  bindTextAreaBlur(e) {
    // 	console.log(e.detail.value)
    // 	this.feedback.content = e.detail.value
    // },
    get_feedback_info() {
      feedback(this.feedback).then((res) => {
        if (res.code == 0) {
          uni.showToast({
            title: "提交成功",
            icon: "none",
          });
          this.feedback.content = "";
          // this.feedback.images = ''
          setTimeout(() => {
            uni.navigateBack({
              delta: 1,
            });
          }, 1500);
        } else {
          uni.showToast({
            title: res.message,
            icon: "none",
          });
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.rounded-120-bottom {
  border-radius: 0 80rpx 0 0;
}
</style>
